﻿@{
    ViewBag.Title = "字典分类管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@model DataDictionaryQueryModel
<div class="row">
    <div class="panel panel-default">
        <div class="panel-body">
            <form class="form-inline" role="form" id="searchForm">
            <div class="form-group">
                <div class="btn-group-sm">
                    <button type="button" class="btn btn-info " id="btnQuery">
                        <i class="fa fa-search"></i>&nbsp;查询</button>
                    <button type="button" class="btn btn-info" id="btnDataDictionaryAddParentDictionary">
                        <i class="fa fa-plus"></i>&nbsp;添加字典分类</button>
                    <button type="button" class="btn btn-info" id="btnDataDictionaryEditParentDictionary">
                        <i class="fa fa-edit"></i>&nbsp;编辑字典分类</button>
                </div>
            </div>
            </form>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-body">
            <table id="flexigridData">
            </table>
        </div>
    </div>
</div>
@section Customer_Js{
    <script type="text/javascript">
        function flexiQuery() {
            $('#flexigridData').bootstrapTable('refresh');
        }

        function dataDictionaryAddParentDictionary() {
            window.location.href = '@Url.Action("AddParentDictionary", "DataDictionary")';
            return false;
        }



        function dataDictionaryEditParentDictionary() {
            var row = $('#flexigridData').bootstrapTable('getSelections');
            if (row == null || row.length == 0) {
                BootStrapUI_Core.alertError('请选择需要编辑的行');
            } else {
                window.location.href = '@Url.Action("EditParentDictionary", "DataDictionary")?id=' + row[0].Id;
            }
            return false;
        }

     

        $(function () {
            $('#btnQuery').on('click', flexiQuery);
            $('#btnDataDictionaryAddParentDictionary').on('click', dataDictionaryAddParentDictionary);
            $('#btnDataDictionaryEditParentDictionary').on('click', dataDictionaryEditParentDictionary);


            btTable('#flexigridData', {
                url: '@Url.Action("AjaxParentIndex", "DataDictionary")',
                columns: [[
                    { field: 'rowscount', checkbox: true, width: 15 },
                    { field: 'Title', title: '名称', width: 100 },
                    { field: 'Code', title: 'Key值', width: 100 },
                    { field: 'Sort', title: '排序', width: 120 },
                    { field: 'CreateTime', title: '创建时间', width: 200 },
                ]]
            });
        })
    </script>
}
